package test.designpattern.strategy;

/**
 * @author YuFeng
 * @create 2018-12-20 19:29
 * @desc 返利策略
 **/
public class RebateStrategy implements CashStrategy {
    private double money;
    private double limit;//返利下限
    private double rebateMoney;//返利多少现金

    public RebateStrategy(double money, double limit, double rebateMoney) {
        this.money = money;
        this.limit = limit;
        this.rebateMoney = rebateMoney;
    }

    @Override
    public double calculate() {
        if (this.money >= limit) {
            this.money -= rebateMoney;
        }
        return this.money;
    }
}
